package day1;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String str=scanner.next();
        Queue<Character>queue=new LinkedList<>();

        if(str!=null){
            queue.add(str.charAt(0));
        }
        for(int i=1;i<str.length();i++){
            char t= queue.peek();
if(str.charAt(i)==t){
    queue.poll();
}else {
    queue.add(str.charAt(i));
}
        }
if(queue.isEmpty()){
    System.out.println(0);
}
        Queue<Character>queue1=new LinkedList<>();
while (!queue.isEmpty()){
    queue1.add(queue.poll());
}
while (!queue1.isEmpty()){
    char x=queue1.poll();
    System.out.print(x);
}
    }
}
